﻿using System.Xml.Linq;

namespace wpf_ImageSearch.Model.YahooApis
{
    public class ThumbnailInfo
    {
        public ThumbnailInfo() { }

        public ThumbnailInfo(XElement xml)
        {
            foreach (var itemField in xml.Elements())
            {
                var value = itemField.Value;
                switch (itemField.Name.LocalName)
                {
                    case "Url":
                        Url = value;
                        break;
                    case "Width":
                        Width = int.Parse(value);
                        break;
                    case "Height":
                        Height = int.Parse(value);
                        break;
                }
            }
        }

        public string Url { set; get; }
        public int Width { set; get; }
        public int Height { set; get; }
    }
}
